Method, device and computer program product for processing information in a memory

ABSTRACT

A method for freeing memory in a device with limited memory. A plurality of pen strokes is entered into the device, each of which is associated with one of a plurality of pages. The pen strokes are stored in electronic form in the memory. According to the method, memory is freed by all the pen strokes associated with a specific page being deleted. The specific page is determined on the basis of a time at which a pen stroke associated with the page was recorded by the device.  
     A computer program product comprises a computer program for carrying out the method. A device has a data processing unit and a memory and means for carrying out the method.

TECHNICAL FIELD

[0001] The present invention relates to a method, a device and a computer program product for freeing memory space in a device with limited memory space, in which device a plurality of pen strokes has been recorded and stored in electronic form.

BACKGROUND TO THE INVENTION

[0002] A user device, for example one of such a kind as is described in WO 01/26033, which is hereby incorporated by reference, can essentially be constructed as a pen. This pen-like device can have a built-in camera for reading a position-coding pattern and data processing means for interpreting, storing and transmitting information from the position-coding pattern. In addition, it can have a working memory for temporary storage of data that has been recorded by the device and a storage memory for permanent or less temporary storage of data. Such a storage memory can consist of, for example, one or a plurality of flash memories or other memories of a suitable size and type.

[0003] The position-coding pattern, for example one of such a kind as is described in WO 01/26033, codes coordinates for points on an imaginary surface which can be very large. Other examples of position-coding pattern are described in, for instance, WO 00/73983 and WO 01/26032, which are hereby incorporated by reference.

[0004] The position-coding pattern can be arranged on a base, for example a sheet of paper, in the form of, for example, printed machine-readable marks. By reading the position-coding pattern, the user unit can be made to initiate predetermined functions or to enter information such as text or graphics on the basis of the read-off coordinates. The position-coding pattern can advantageously be divided into subareas, for example for particular applications, but it can also be divided into subareas intended to correspond to a physical page size in, for example, a notepad. Such divisions into subareas can be interpreted by the user device as pages, so that the user device can process items of information that are entered from, for example, a page in a notepad as belonging together.

[0005] Permanent storage of data can be achieved by the content of the user device's storage memory being transferred to or synchronized with, for example, a server, the user's computer or a personal digital assistant (“PDA”). Such synchronization can be carried out via suitable known communication media, such as short-range radio link (for example Bluetooth®), IrDA, cable, the Internet, mobile telephone or other technologies that make the electronic transmission of information possible.

[0006] When the user device is passed over a base with a position-coding pattern, the device records and decodes the position-coding pattern and calculates pairs of coordinates for positions on a page to which the base corresponds. Pairs of coordinates, or series of pairs of coordinates, can be stored in the user device and, if necessary, can be processed by, for example, character recognition to convert hand-written information into machine-readable information.

[0007] The recording of a series of pairs of coordinates can be initiated by a pressure sensor in the user device detecting that the device has been lowered onto a base. The recording is terminated by the pressure sensor detecting that the user device has been raised from the base. The series of coordinates that has been generated between the user device being lowered and being raised is hereinafter called a “pen stroke”.

[0008] A pen stroke can be stored in electronic form in the user device's storage memory together with, for example, information about on which part of the position-coding pattern and/or at what time the pen stroke was recorded. For example, the starting time of each pen stroke can be recorded. With a coordinate resolution in the order of three or more pairs of coordinates per millimeter, it is recognized that the number of pairs of coordinates that are recorded by the user device in connection with, for example, a text being written down can become very large, particularly if a high sampling rate, for example 50-100 Hz, is used. The number of pairs of coordinates can be reduced, however, by means of various forms of compression.

[0009] In WO 99/50787 an additional concept is described in which the reading of a position-coding pattern is used in order to generate information about the extent of a pen stroke across a page and also about with which page the pen stroke is associated.

[0010] As the built-in storage memory capacity of the user device can be limited by the space that is available for the incorporation of memory medium in the user device, there is a risk that the user device's storage memory can become full.

[0011] One way of handling this is described in U.S. Pat. No. 6,055,552, where pen strokes for complete pages are deleted when the pages are sent from the device to a unit such as a computer. This means that it is necessary to transfer the memory content to the computer at regular intervals in order that the memory will not become full, which in turn limits the time during which the device can function independently, that is without contact with the computer.

[0012] There is a need for a memory management method without a user interface, or at least with the simplest possible user interface.

SUMMARY OF THE INVENTION

[0013] An object of the present invention is to provide a method for memory management, which has a user interface that is easy to understand.

[0014] This object is achieved wholly or partially by a method according to claim 1, a computer program product according to claim 18 and a device according to claim 19. Preferred embodiments are defined in the independent claims and in the description below.

[0015] Thus a method is provided for freeing memory in a device with limited memory, into which device a plurality of pen strokes is entered. Each of the pen strokes is associated with one of a plurality of pages and is stored in electronic form in the memory. When space in the memory is to be freed, all the pen strokes associated with a specific page are deleted. The specific page is determined on the basis of a time at which a pen stroke associated with the page was recorded by the device.

[0016] By freeing memory page by page instead of deleting individual pen strokes, better organized memory management is achieved as only complete pages are deleted from the storage memory, whereby the number of isolated pen strokes that remain in the device's memory and take up space will be reduced or completely eliminated, while at the same time the memory is freed in well-defined units that are intuitive for the user. In addition, good conformity is achieved between the information on the base, that is the sheet of paper, and information in electronic form on the page. In addition, repeated transmissions of the memory content are made possible, for example to different servers, computers or PDAs. In addition, by selecting the pages that are to be deleted on the basis of the time of the recording of an associated pen stroke, the user's involvement in the memory freeing process can be wholly or partially eliminated.

[0017] According to the method, the specific page can be determined on the basis of its most recently recorded pen stroke having been recorded earlier than the most recently recorded pen stroke of any of the other pages.

[0018] This is a way of selecting the pages whose pen strokes are to be deleted, in such a way that the pages that were used most recently are retained, while older pages' pen strokes are deleted and thereby make room for new pen strokes. By the determination of which pages are to be deleted being carried out in this way, a rule is created that is easy for the user to understand: pages that have not been used for a long time are deleted from the memory.

[0019] Alternatively, the specific page can be determined by a pen stroke associated with the specific page having been recorded prior to a predetermined time. The predetermined time can be a particular date, or can be relative to the date when the page was recorded or used, so that for example a discount coupon is deleted two weeks after it has been used. Alternatively, the predetermined time can be relative to the current date, so that, for example, pages that are more than two weeks old are deleted.

[0020] This is another way of selecting the pages that are to be deleted, in which the oldest pages are selected, irrespective of whether they have been used recently or not. This method can be particularly advantageous for the utilization of, for example, time-limited offers.

[0021] According to the method, the specific page can be determined by a page proposed by the device being confirmed by the user. Although this method requires a certain degree of involvement on the part of the user, it can be preferable in certain situations, in particular if there are pages that the user can be expected to want to retain, irrespective of their age.

[0022] The invention can advantageously be implemented as a computer program product or a device comprising application-specific circuits, such as ASIC. Thus a computer program product comprising a computer program for freeing memory in a device with limited memory is also covered by the invention. When executed, the computer program carries out the method described above.

[0023] In addition, the invention comprises a device for electronic recording of pen strokes, each of which is associated with a page. Such a device can comprise a data processing unit that has a memory with limited space for storing the pen strokes in electronic form. The data processing unit is arranged to free space in the memory by deleting from the memory all the pen strokes associated with a specific page. The data processing unit is also arranged to determine the specific page on the basis of a time at which a pen stroke associated with the page was recorded by the device.

[0024] The invention is particularly suitable for handling a situation in which a plurality of pen strokes is recorded from a plurality of different pages, which do not need to be used in any particular order and which can be used repeatedly even if other pages are used in between.

BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The invention will be described in more detail below, with reference to the accompanying schematic drawings which, for the purpose of exemplification, show currently preferred embodiments of the invention, according to its different aspects.

[0026]FIG. 1 shows schematically a prior-art user device, in which the present invention can be implemented.

[0027]FIG. 2 shows schematically a prior-art coordinate system, which is divided into pages and subareas.

[0028]FIG. 3 shows a schematic diagram of a storage memory block, which can be incorporated in the user device in FIG. 1.

[0029]FIG. 4 shows schematically a plurality of pages provided with position-coding patterns on which a plurality of pen strokes can be made.

[0030]FIG. 5 shows a Gantt-chart-style diagram of the distribution of the pen strokes in FIG. 4 over the pages and time.

[0031]FIG. 6 shows a schematic diagram of the storage of the pen strokes in FIG. 1 in a memory block as shown in FIG. 3.

[0032]FIG. 7 shows schematically a page address range.

[0033]FIG. 8 shows a flow chart for a method for freeing memory in the device in FIG. 1.

[0034]FIG. 9 shows schematically the data processing unit in the device according to FIG. 1.

DESCRIPTION OF PREFERRED EMBODIMENTS

[0035]FIG. 1 shows a prior-art user device 1, which is described in more detail in, for example, WO 01/26033, WO 00/73983 and WO 01/26032. The device 1 has a camera 2 which is arranged to read in real time a position-coding pattern that is arranged on a base. On the basis of the position-coding pattern, coordinates are calculated for the positions that are marked using the pen point 3 of the device. This pen point can be, but does not need to be, arranged to act as an ordinary pen point for writing down characters or images on a base such as a sheet of paper. In addition, the device has a data processing unit 7 that comprises data acquisition means 6 designed to process incoming data from the camera 2, working memory 4 and storage memory 5 and a programmable data processor 10 in the form of, for example, a computer processor. In addition, the device can have a power supply unit 8 in the form of, for example, a battery and a communication unit 9 for communication with external units. Such communication units can, for example, utilize infrared technology, cable or short-range radio link, such as Bluetooth®.

[0036]FIG. 2 shows schematically a coordinate system 20 for an imaginary surface. Coordinates on the imaginary surface can be coded by a position-coding pattern which can be arranged on a base. The coordinate system can be divided into a plurality of pages 21, 22, 23, 24, which can be divided into subgroups or subareas 25 of the imaginary surface. Position-coding patterns that code the coordinates that are encompassed by the respective page can be arranged on a base, such as a sheet of paper, in order to enable an electronic copy to be obtained of information that is written down on the base using the user device 1. By “page” is thus here meant a digital page, which can constitute completely or partially an electronic copy of a physical base.

[0037] In a pair of coordinates it is thus possible to code a unique page address of the page to which the pair of coordinates belongs. The page address can then be decoded by the user device at the time of the recording, or later.

[0038] A pen stroke can be stored in the device's memory as a series of pairs of coordinates which describe the movement of the device across a base provided with the position-coding pattern. The pen stroke can contain a page address that indicates on which page or in which subarea of the imaginary surface the pen stroke has been recorded and a time that indicates when the pen stroke was recorded.

[0039] In a method, such as the one shown in FIG. 8, for determining which pages (and their associated pen strokes) are to be deleted from the storage memory 5, it is expedient in a first step 80 to determine a time for the most recently recorded (the youngest) pen stroke on each page. Thereafter, in a second step 81 the pages are selected for deletion which have the oldest most recently recorded pen stroke.

[0040] According to one embodiment, the determination of which pages are to be deleted is carried out in its entirety at the time when it is necessary to free storage memory space.

[0041] In the following, the method will be described in outline and thereafter in the form of an example in which eleven pen strokes have been recorded on four different pages. The method according to this example can appear trivial, but it is to be borne in mind that the method is actually intended and is suitable for the management of tens of thousands of pages and pen strokes or more.

[0042] For the identification of the most recently entered pen stroke on the respective page, all the pen strokes stored in the memory can be searched, with the page address and the time of recording being extracted for each of the pen strokes. Thereafter entries are stored comprising a time for each page address in a first sortable data structure in the memory, which in the following will be called the page address table, since the search key of the data structure is the page address. The entries are stored in the page address table in such a way that a list is obtained of page addresses occurring in the memory and the most recent (youngest) time associated with each page address. optionally, the entries in the page address table can contain additional parameters, such as a measure of the memory space that can be freed by the pen strokes associated with the page being deleted. The size A of the table can be selected on the basis of the estimated number of page addresses in the device's storage memory, the available storage memory and the processing speed of the device.

[0043] In a device that contains pen strokes from a very large number of pages, the data structure in which page addresses and times are stored can, however, become very large.

[0044] In order to keep down the size of these data structures, a second sortable data structure is created, below called a time table, since the search key of the data structure is the time. This second data structure also comprises entries with page addresses and times of the most recently recorded pen stroke for the respective page address. Whereas the first data structure is sorted with regard to the page address, the second data structure is sorted with regard to the time of recording. In this example, the time table is assumed to contain B entries. The size B is selected on the basis of factors such as the number of pages that need to be removed in normal conditions in order to free the required amount of storage space and the processing speed of the device.

[0045] According to one embodiment, both the page address table and the time table can be so-called max-heaps. The advantage of these is that they take up relatively little storage space and that operations such as adding and extracting data values are carried out very quickly, even if the heap is very large. A more detailed description of heaps is to be found in Kingston, J. H.: Algorithms & Data Structures: Design, Correctness, Analysis, Addison-Wesley Publishing Co., 1995.

[0046] In order to determine which page addresses are to be searched, an overall search range can be selected, that is the range of page addresses which are to be searched in the device's storage memory and the maximal recording times of which are to be identified. At the start of the method, the overall search range can be selected as either the total number of available page addresses in accordance with the division of the imaginary surface into pages, or on the basis of the total page address range that is stored in the device's storage memory. With the latter alternative, information regarding the highest and lowest page address that is stored in the device's storage memory can be used. Such information can be kept available in the device relatively easily.

[0047] The search is suitably commenced at the lower limit of the overall search range, searching in the memory being carried out for page addresses belonging to a first sub-range of the overall search range, and the first data structure being gradually filled up as new page addresses in the range are encountered. If the first data structure becomes full, the encountered page addresses that are already stored in the table will be updated with regard to the time. Other page addresses encountered will be compared with the data structure's largest page address and will replace this if the page address encountered is less than said largest page address. The page addresses that are larger than said largest page address will thereby be searched during a subsequent iteration. If the first data structure holds A entries, the search of the first sub-range will thus result in the A lowest page addresses that occur in the device's memory.

[0048] When all of the first search range has been searched, entries are copied to the second data structure, which is sorted with regard to the time. If the second data structure holds a smaller number of entries than the first data structure, the entries that have the oldest times will be transferred.

[0049] When the first data structure has been searched and entries have been transferred to the second data structure, the first data structure is cleared.

[0050] Thereafter, a second sub-range of page addresses is created, the lower page address of which will be adjacent to the upper limit of the first sub-range and the upper limit of which can coincide with the upper limit of the overall search range.

[0051] A further search is then carried out in the device's memory for the page addresses that are included in the second sub-range, whereby the first data structure will contain the A next page addresses in order of size.

[0052] After the search of the second sub-range's page addresses, the transfer of times to the second data structure is repeated, so that this will contain the entries that correspond to the pages that have the B oldest recording times from among the 2A lowest page addresses.

[0053] Thereafter the method is repeated with clearing of the first data structure, the creation of a new sub-range, searching for page addresses in the memory and transferring of entries to the second data structure, until all or a sufficient number of the page addresses occurring in the device's memory have been searched and the time table contains the B least maximum times, that is the B pages that have the oldest most recent recording times.

[0054] If a binary heap is used as the second data structure, the recording times in the heap may not necessarily all be correctly sorted relative to each other. However, the entry in the second data structure that has the maximal (that is the youngest) recording time is always obtained.

[0055] In order to create a list of a number of pages that are to be deleted from the device's storage memory, it is possible to create a third data structure that constitutes a result table with C entries, which table is filled by C maximum values being extracted from the time table. The result table is preferably arranged in such a way that its extreme value consists of the page address with the oldest most recently recorded pen stroke. It can in addition advantageously be completely sorted, so that a prioritizing list of the pages that are to be removed is obtained.

[0056] The second and third data structures can be, but do not need to be, of the same size. The third data structure is arranged to contain the page addresses that have the oldest most recently recorded pen strokes.

[0057] As an alternative, a sorted list can be used for the second data structure, which list can easily be sorted and thereby indicate the pages that are to be deleted. Accordingly, no result table in the form of a third data structure needs to be used.

[0058] WO 01/75781, which is hereby incorporated by reference, describes how pages can be associated with each other. One way of handling this in connection with the freeing of memory is to process associated pages as a unit, that is if a page with which other pages are associated is deleted, the associated pages are also deleted from the device's memory.

[0059] In order to illustrate the method further, it is now shown with reference to FIGS. 4-7 how a number of pen strokes a-k have been recorded at the times t_(a)-t_(k) on four different pages 21-24, which can consist of four different bases provided with position-coding patterns. The pages 21-24 have the page addresses PA₁-PA₄, which can be read from the position-coding pattern. For the times t_(a)-t_(k), it is the case that t_(a)<t_(b)<t_(c)<t_(d)<t_(e)<t_(f)<t_(g)<t_(h)<t_(i)<t_(j)<t_(k), that is a is the first recorded pen stroke and k is the last recorded pen stroke.

[0060] In FIG. 4, a, b, and h have been recorded on a first page 21 at the times t_(a), t_(b) and t_(h). On a second page 22, the pen strokes c, d and k have been recorded at the times t_(c), t_(d) and t_(k). On a third page 23, the pen strokes e, f and j have been recorded at the times t_(e), t_(f) and t_(j) and on a fourth page 24, the pen strokes g and i have been recorded at the times t_(g) and t_(i) respectively.

[0061]FIG. 5 shows a Gantt-chart-style diagram with page addresses (PA₁-PA₄) on the y axis and the recording times t_(a)-t_(k) on the x axis.

[0062]FIG. 6 shows a schematic diagram of how the pen strokes a-k can be stored in a storage memory in the device. In the diagram in FIG. 6, all the pen strokes are stored in a sequence, but the invention is also applicable to pen strokes that are not stored in a sequence, but are distributed arbitrarily in the device's storage memory.

[0063]FIG. 7 illustrates the search range from PA_(min) (PA=Page Address) to PA_(max). PA_(min) can be 0 or the lowest page address stored in the device's storage memory, while PA_(max) can be the maximal possible page address according to the position-coding pattern or the highest page address stored in the device's storage memory. The four pages' page addresses PA₁, PA₂, PA₃ and PA₄ are to be found in the search range.

[0064]FIG. 8 shows a flow chart for a method according to an embodiment of the invention.

[0065] In a first step (not shown) a first page address table 61 is created. To illustrate the principle, A=3 is selected as the table size, that is, the table will hold three page addresses. In addition, a time table is created. The size B of the time table is also set to 3, but it is recognized that other values are also possible for the tables. A practical value for A or B may be 100, but A and B do not have to be the same size. A first search range I₁ is created in step 70 and is set to PA_(min) . . . PA_(max), where PA_(min) can, for example, be 0 or a known value of the lowest page address that is stored in the storage memory. Thereafter in step 70′, a search is carried out in the storage memory 5 for page addresses belonging to the search range II. When a page within the search range I₁ is encountered for the first time in the storage memory 5, it is stored in step 71 as an entry in the page address table 61. If the page address has been encountered at an earlier time and is thus included in an existing entry that is stored in the page address table 61, the recording time of the entry is updated in the page address table in step 72 instead, so that the page address table 61 contains the most recent recording time for the respective page address. If the size of the page address table is limited and the page address table is full, the highest page address in the table can be replaced by an encountered page address if the encountered page address is lower than the highest page address in the table, so that the page address table will contain the A lowest page addresses.

[0066] After a first search, the page address table can appear as follows: TABLE 1 Page address table after first search. Page address Recording time PA₃ t_(j) PA₂ t_(k) PA₁ t_(h)

[0067] Thereafter a second data structure is created, below called time table 62. In step 74, the time table 62 is filled with values from the page address table, so that the time table 62 will contain entries that were copied from the page address table, and that are sorted with regard to the time of recording. TABLE 2 Time table after first search. Recording time Page address t_(k) PA₂ t_(j) PA₃ t_(h) PA₁

[0068] As A=3, the size of the first search range is PA_(min)-PA₃. Thereafter, in step 75, a check is carried out whether all the page addresses have been searched. If such is not the case, in step 70 a second search range is created as T₂=PA₃+1 . . . PA_(max).

[0069] Thereafter a second search is carried out, whereby a second page address table, table 3, is created. As an alternative, the first page address table can be cleared and thereby form the second page address table.

[0070] After the second search, the second page address table will appear as follows: TABLE 3 Page address table after second search. Page address Recording time PA₄ t_(i)

[0071] Now all the page addresses have been encountered and accordingly no new search range needs to be created. If, however, there had been additional page addresses in the memory, entries from the page address table would have been transferred to the time table, after which the page address table is cleared, a new search range is created and a new search is carried out.

[0072] As the time table is not cleared, the most recent recording time t_(i) for the fourth page PA₄ is compared with the most recent recording time in the time table, t_(k), it being determined that t_(i)<t_(k) and hence that t_(i) is to replace t_(k), so that the time table appears as below: Recording time Page address t_(i) PA₄ t_(j) PA₃ t_(h) PA₁

[0073] The time table is thereafter sorted, giving the following appearance: TABLE 5 The time table after t_(i) has replaced t_(k) and t_(he) table has been sorted. Recording time Page address t_(j) PA₃ t_(i) PA₄ t_(h) PA₁

[0074] Table 5 now indicates the three pages that have the oldest most recent recording times, but as the time table in the example is a max heap, the times are in the wrong order. This can be remedied by the creation of a third data structure 63, below called a result table, table 6. This table has a size C, that has been set to 3. In step 77, the result table is filled successively from the bottom by the maximum value from the time table being extracted repeatedly in step 76, so that the following appearance is obtained: TABLE 6 Result table. Recording time Page address t_(h) PA₁ t_(i) PA₄ t_(j) PA₃

[0075] Table 6 now shows a table that specifies correctly in which order the pages are to be deleted from the device's storage memory 5 in step 78. In association with (that is before or after) the deletion in step 78, a check is carried out in step 79 that the memory freed by the procedure is sufficient according to the criteria that have been determined for how much memory is to be freed. If insufficient memory has been freed, the procedure recommences from step 70.

[0076] Suitable data structures for implementing the invention should be of such a type that they have at least the functions “insert”, “find” and “remove/extract”. Examples of data structures that can be used are symbol tables such as sorted lists, search trees (binary, B-trees, Splay trees) stacks or hash tables. Priority queues such as heap-arranged trees or binary heaps can also be used. A plurality of such data structures is described in Kingston, J. H.: Algorithms & Data Structures: Design, Correctness, Analysis, Addison-Wesley Publishing Co., 1995.

[0077] If an ordinary completely sorted table is used instead, this can simply be rearranged so that the required sequence is obtained. It can also be advantageous to cascade couple one or more symbol tables.

[0078] As another alternative to the above-mentioned data structures, it is possible to use an unsorted vector, in which linear searching is carried out.

[0079]FIG. 9 shows schematically a data processing unit 7 in a device 1 which is suitable for implementing the method described above. The data processing unit can contain a general programmable processor or signal processor, equipped with suitable software for the implementation of the method, or a circuit specially adapted for the purpose (of the type ASIC or the like). In addition, the data processing unit can have a storage memory 5, in which, for example, pen strokes 30 can be stored, and a working memory 4 in which among other things data structures 61-63 can be stored.

[0080] In addition, the device can have means 50 for identifying a plurality of page addresses stored in the memory and for identifying the time of the most recently recorded pen stroke associated with the respective page address, means 51 for selecting one page from among the identified pages, which page has a most recently recorded pen stroke that was recorded furthest back in time, and means 52 for deleting the selected page from the memory 5.

[0081] In addition, the means 50 for identifying a plurality of pages can comprise means 53 for searching in the memory for a plurality of page addresses associated with pen strokes, means 54 for storing in a first data structure a page address and associated time encountered in the memory, and means 55 for updating the time when a page address stored in the first data structure 61 is encountered in the memory, so that the most recent time for the page address is stored in the first data structure 61.

[0082] The means 51 for selecting a page can additionally comprise means 57 for creating a second data structure 62, which is intended to receive and arrange page addresses and times from the first data structure 61 on the basis of the time at which the most recently recorded pen stroke was recorded for the respective page address, and means 56 for identifying in the second data structure 62 the page that has the time that lies furthest back in time.

[0083] The second data structure 62 can contain a predetermined number of entries, which are sorted in such a way that at least an extreme value, that is a largest (maximum) or a smallest (minimum) value, is obtained, which corresponds to the page address that is associated with the most recently recorded pen stroke.

[0084] The means 56 for identifying can comprise means 58 for the creation of a third data structure 63 which can contain, but does not need to contain, the same number of page addresses as the second data structure 62, means 59 for extracting the extreme value from the second data structure 62, and means 60 for repeated filling of the third data structure 63 from the bottom or from the back with the extreme value for the second data structure 62 until the third data structure 63 is full. The third data structure advantageously consists of a table that is sorted in such a way that the page address that has the smallest, that is the oldest, time comes first and the page address that has the largest, that is the most recent, time comes last. The table is filled from the back by maximum values being extracted repeatedly from the second data structure and inserted in the table “from the bottom”.

[0085] The method described above is intended to be used in a situation where the device's storage memory is limited and where there is no upper limit to how many pages there can be in the device's storage memory. Therefore the method is also carried out at the times when the device's storage memory starts to become full.

[0086] The method can be implemented relatively easily in real time if the device is provided with sufficient working memory or storage memory to be able to hold data structures of the size that would be required in order to be able to scan a very large number of page addresses. With such a method page address tables and time tables can be kept updated in real time as new pen strokes are recorded and pages can be deleted from the storage memory as this is filled up.

[0087] As an alternative, it is possible, when carrying out the method in real time, to limit the number of page addresses that are allowed in the device's storage memory in order thereby to keep down the sizes of the page address table and the time table.

[0088]FIG. 3 shows how pen strokes can be stored as sequences of data bits in the storage memory 5 of a user device 1 and in particular in a storage memory of the flash memory type. FIG. 3 shows the storage memory 5 as a series of storage locations 31-39. The storage locations can be of variable length, that is comprising different numbers of data bits.

[0089] In addition, FIG. 3 shows schematically how pen strokes are stored sequentially. A pen stroke 30, which will be described in greater detail below, is stored after a preceding pen stroke 30′ and before a subsequent pen stroke 30″.

[0090] A pen stroke 30, 30′, 30″ can be of variable length 30 a, as it consists of two parts: a part of fixed length 30 b with data that applies to the whole pen stroke and a part of variable length 30 c that among other things contains the pairs of coordinates XY that are included in the pen stroke. The second part can also contain additional information related to the respective pair of coordinates, as described below.

[0091] The first part 30 b can have a “stroke header” SH that tells that a new pen stroke is following in the storage memory and an “offset” OS that tells the number of bits that are to be found between the start of this pen stroke 30 b and the start of the next pen stroke 30″. In addition, the first part can have a time ST that tells when the pen stroke was recorded, for example the start time or finish time for the recording of the pen stroke. In addition, the first part 30 b can comprise a page address PA that tells on which page of the imaginary surface the pen stroke 30 was recorded or started to be recorded. Each electronically stored pen stroke is hereby associated with a page via a page address PA. The page address PA can have a plurality of fields, which for example represent the relationship of the page to the imaginary surface, such as affiliation to subareas, type of area, etc. The total number of page addresses can be seen as a continuum of page addresses and thereby likened to numbers on a number scale. Thus, on the basis of the relationships between the page addresses, it can be said that a first page address is larger than a second page address if the first page address lies to the right of the second page address on the number scale.

[0092] The second part 30 c of the pen stroke 30 can be of variable length, as it can contain the whole series of pairs of coordinates that are included in the pen stroke. The series of pairs of coordinates can be of varying length depending upon the length of the pen stroke. The series of pairs of coordinates is stored in the time order in which the pairs of coordinates were recorded. Thus, with knowledge of the user device's sampling rate and the start time of the pen stroke, it is possible to determine when each coordinate was recorded. According to one embodiment, a “coordinate header” CH can be stored for each recorded pair of coordinates, which coordinate header can describe a format in which associated pairs of coordinates are stored, that is whether the coordinates are compressed, whether they comprise coordinate numbers CN for each pair of coordinates, and whether they comprise force components or angle indications for the orientation of the user device during the recording.

[0093] A pen stroke 30 can also comprise an EOS (End of Stroke) that indicates the end of the pen stroke. This EOS can be provided with an indication that the pen stroke goes over several pages, that is that the pen stroke creates an association between the pages. In addition, the associated page address can be indicated in EOS. It is also possible to arrange an indication in SH that the pen stroke is included in an association and which page address is included in the association.

[0094] When a pen stroke starts to become recorded, that is when the user device is lowered onto a base, a stroke header SH is first written to the storage memory. This can initially be set to a value that indicates that the pen stroke is incorrect. When the user device is then raised from the base and the pen stroke is terminated, the stroke header SH can be rewritten to a value that indicates that the pen stroke is normal. In addition, the offset OS can be updated to indicate the correct length of the pen stroke. In this way, interrupted pen strokes can be recorded in the storage memory as incorrect if an interruption should occur during the recording of a pen stroke. These incorrect pen strokes can, for example, be recovered where possible or can simply be deleted.

[0095] When a pen stroke 30 is to be deleted from the storage memory, this can be carried out by the stroke header SH being changed to a value that indicates that the space is deleted. In this way, the storage memory space in which the pen stroke was stored becomes available again for writing of new information, as soon as the storage memory space has been defragmented.

[0096] Freeing of storage space 5 can be initiated when a certain amount of the storage memory 5 is full. When freeing of the storage space has been initiated, this can continue until a certain amount of the storage memory is free. As an example, freeing of the storage memory can be initiated when 3% of the storage memory space is free and can be terminated when 10% of the storage memory space has become free. After freeing the storage memory, it is expedient to defragment the storage memory in a way that is known to those skilled in the art.

[0097] It is further expedient, when freeing storage memory, to lock the pages that are being used, for example the most recently recorded pages, so that the previously recorded content in them does not disappear during a freeing of storage memory while the user is in the process of entering new pen strokes on the page.

[0098] An alternative way of selecting which pages are to be deleted is to let the user determine this. A first example of how this can be carried out is that each page is provided with a “delete” field, all the pen strokes associated with the page being deleted from the device's storage memory when this field is marked by the device.

[0099] A second example is that by means of a suitable method, for example according to a method such as the one described above, the device selects a number of pages that can be deleted and suggests these to the user via a suitable interface (for example a PDA, mobile telephone, computer, etc), with the user being given the opportunity to confirm which pages are to be deleted from the storage memory.

[0100] A third example is that the user writes or enters in some other way a “delete” command and in association with this indicates in a suitable way a page that is to be deleted.

[0101] Another way of selecting pages that can be deleted from the storage memory is to specify a date upon which the respective page is to be deleted. This can be carried out, for example, by a “delete” table being created in the device, where pages with a “best before date” are listed. This can be particularly advantageous for recording pen strokes originating from, for example, pages that are associated with time-limited offers such as advertisements, etc. If required, this can also be combined with a suitable reminder mechanism.

[0102] An alternative to this is to delete all pages that have a pen stroke that is older than a certain predetermined date.

[0103] Another alternative is that as soon as all the pen strokes associated with a page have been sent to an external unit, such as a computer, a PDA, a server, etc, the pages are deleted from the device's storage memory.

[0104] It is also possible, within the scope of the present invention, to combine the methods described above.

[0105] For example, pages within the imaginary surface can be classified in such a way that they are given different attributes prior to deletion or sorting. Thus, pages of certain types can be deleted straight away without any involvement by the user, while pages of other types require the user to confirm that they can be removed. Some types of pages can be specified so that they are removed automatically after a certain date and others can be removed once they have been sent to an external unit.

[0106] It is also possible to transfer information between the device's storage memory and working memory, so that data, such as pen strokes, data structures and the like, is available for processing from the memory that is the most expedient for the purpose. Thus the working memory and the storage memory can be interchangeable in respect of where the method is carried out and where the data is stored. 

What we claim and desire to secure by Letters Patent is:
 1. A method for freeing memory in a device with limited memory, into which device a plurality of pen strokes is entered, each of which pen strokes is associated with one of a plurality of pages and is stored in electronic form in the memory, all the pen strokes associated with a specific page being deleted (78) when space in the memory is to be freed, characterized in that the specific page is determined on the basis of a time at which a pen stroke associated with the page was recorded by the device.
 2. The method as claimed in claim 1, characterized in that the specific page is determined on the basis of its most recently recorded pen stroke having been recorded earlier than the most recently recorded pen stroke of any of the other pages.
 3. The method as claimed in claim 1, characterized in that the specific page is determined by the steps of identifying (80) page addresses for the pen strokes stored in the memory and the time of the most recently recorded pen stroke associated with the respective pages, and selecting (81) from the identified pages the specific page as the page which has the oldest most recently recorded pen stroke.
 4. The method as claimed in claim 3, characterized in that the step of identifying (80) page addresses for the pen strokes stored in the memory comprises searching (70′) in the memory for a plurality of page addresses associated with pen strokes, if a page address encountered during the search (70′) is not stored in a first data structure (61), storing (71) this page address and a time associated therewith in a first data structure (61), and if the page address encountered is already stored in the data structure (61), updating (72) the time therein associated with the page address so that the latest time of the page address is stored in the first data structure (61).
 5. The method as claimed in claim 4, characterized in that the step of searching (70′) in the memory is restricted to predetermined page addresses belonging to a first search range.
 6. The method as claimed in claim 5, characterized in that the step (80) of identifying page addresses for the pen strokes stored in the memory is repeated for a plurality of further search ranges, which together comprise page addresses for a considerable portion of the pen strokes stored in the memory.
 7. The method as claimed in any one of claims 4-6, characterized in that the step (80) of identifying page addresses for the pen strokes stored in the memory comprises for each search range going through the first data structure and arranging page addresses and times from the first data structure in a second data structure according to predetermined rules.
 8. The method as claimed in claim 7, characterized in that the rules comprise the rule that, if the second data structure is full and an encountered page address in the first data structure (61) has a time that is older than a youngest time in the second data structure (62), said youngest time in the second data structure (62) is replaced by said encountered page address, so that the second data structure comprises the page addresses with which the oldest most recently recorded pen strokes are associated.
 9. The method as claimed in claim 7 or 8, characterized in that the second data structure contains a predetermined number of page addresses and is arranged for extraction of an extreme value, which corresponds to the page address that has the most recently recorded pen stroke.
 10. The method as claimed in any one of claims 7-9, characterized in that the step (81) of selecting the specific page comprises selecting (76) from the (continued) (continued claim 10) second data structure the page address that has the oldest time.
 11. The method as claimed in claim 10, characterized in that a plurality of page addresses and times from the second data structure are arranged in a third data structure, so that this contains the page addresses with which the oldest times are associated.
 12. The method as claimed in claim 11, characterized in that the page addresses arranged in the third data structure are sorted with regard to their associated times, so that the extreme value consists of the page address with which the oldest time is associated.
 13. The method as claimed in any one of claims 7-12, characterized in that one of the first and the second data structures is one of a symbol table, a sorted list, a search tree, a hash table, a priority queue, a stack, a heap-arranged tree and a binary heap.
 14. The method as claimed in any one of claims 7-13, characterized in that the second data structure (62) is arranged to produce a sorted list of a plurality of page addresses with which the oldest most recently recorded pen strokes are associated.
 15. The method as claimed in claim 1, characterized in that the specific page is determined (continued) (continued claim 15) by a pen stroke associated with the specific page having been recorded prior to a predetermined time.
 16. The method as claimed in claim 1, characterized in that the specific page is determined by a page suggested by the device being confirmed by the user.
 17. The method as claimed in any one of the preceding claims, characterized in that a pen stroke is deleted by a state indicator for the memory space that is to be deleted being changed to indicate that the memory space is available.
 18. A computer program product comprising a computer program for freeing memory in a device with limited memory, characterized in that, when executed, the computer program carries out the method according to any one of claims 1-17.
 19. A device for electronic recording of pen strokes, each of which is associated with a page, which device comprises a data processing unit (7), that has a memory (4, 5) with limited space for storing the pen strokes in electronic form, the data processing unit (7) being arranged to free space in the memory (5) by deleting from the memory (5) all the pen strokes associated with a specific page, characterized in that the data processing unit (7) is arranged to determine (continued) (continued claim 19) the specific page on the basis of the time at which a pen stroke associated with the page was recorded by the device.
 20. The device as claimed in claim 19, characterized in that the device has means for carrying out a method according to any one of claims 1-17. 